<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <link rel="stylesheet" type="text/css" href="../static/layui/css/layui.css">
    <script type="text/javascript" src="../static/js/jquery-3.3.1.min.js"></script>
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
    <style>
        /*鼠标放上小手标志*/
        font {
            cursor: pointer;
        }
    </style>
</head>
<body>
<div class="demoTable" style="position: absolute;z-index: 1000 ;margin-top: 5px;">
    <form>
        <select id="domoin" name="domoin" style="width: 180px;height: 38px;border-color: #efefef;"></select>

        <select id="departments" name="departments" style="width: 180px;height: 38px;border-color: #efefef;"></select>

        <select id="itemsObjname" style="width: 80px;height: 38px;border-color: #efefef;">
            <option value="">申报类型</option>
            <option value="1">单位</option>
            <option value="0">个人</option>
        </select>
        <select id="itemsState" style="width: 80px;height: 38px;border-color: #efefef;">
            <option value="">审核状态</option>
            <option value="1">待审核</option>
            <option value="2">审核中</option>
            <option value="3">已驳回</option>
            <option value="4">已通过</option>
        </select>


        <div class="layui-inline">
            <input class="layui-input" name="demoReload" id="demoReload" autocomplete="off" placeholder="请输入关键词">
        </div>
        <button class="layui-btn" data-type="reload" id="reload">查询</button>
        <div class="layui-input-inline">
            <input type="reset" class="layui-input"
                   style="width: 60px;height: 38px;text-align: center;background-color:#16c4ff;color: white ">
        </div>
    </form>
</div>
<script type="text/html" id="zizeng">
    {{d.LAY_TABLE_INDEX+1}}
</script>
<table class="layui-hide" id="test" lay-filter="test"></table>


<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <a lay-event="addlevel">
            <button class="layui-btn layui-btn-sm" onclick="addle()" style="float: right;margin-right: -80px; margin-top: 10px;">
                添加项目
            </button>
        </a>
        <button class="layui-btn layui-btn-sm" id="deleteUserByIds" style="float: right;margin-right: 20px; margin-top: 10px;">批量删除</button>
    </div>

</script>
<!-- 操作指令 -->
<script type="text/html" id="barDemo">
    <a lay-event="edit">
        <font color="#0000FF">编辑</font>
    </a>
    <a>|</a>
    <a lay-event="stop">
        <font color="#0000FF">停用</font>
    </a>
    <a>|</a>
    <a lay-event="del">
        <font color="red">删除</font>
    </a>
</script>


<script src="../static/layui/layui.js"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->

<script>
    layui.use('table', function () {
        var table = layui.table;
        table.render({
            elem: '#test',
            url: 'projman',
            toolbar: '#toolbarDemo',
            defaultToolbar: ['exports'],
            title: '项目管理表',
            id: 'testReload',
            cols: [
                [{
                    type: 'checkbox'
                    // fixed: 'left'
                }, {
                    field: 'zizeng',
                    width: 110,
                    title: '序号',
                    templet: '#zizeng',
                    hide: true
                }, {
                    field: 'item_id',
                    title: 'ID',
                    hide: true
                }, {
                    field: 'item_title',
                    title: '标题',
                    // width: 1175,
                    align: 'center'
                },{
                    field: 'item_obj',
                    title: '申报对象',
                    // width: 1175,
                    align: 'center'
                },{
                    field: 'ctn_circularName',
                    title: '包含通知',
                    // class: 'circular_title',
                    // width: 1175,
                    align: 'center'
                },{
                    field: 'cps_cpName',
                    title: '包含政策',
                    // class: 'circular_title',
                    // width: 1175,
                    align: 'center'
                }, {
                    fixed: 'right',
                    title: '操作',
                    toolbar: '#barDemo',
                    width: 450
                }]
            ],
            page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']//自定义分页布局
                , first: false //不显示首页
                , last: false //不显示尾页
            },
            height: 550,
            done: function (res, curr, count) {
                $("[data-field='item_obj']").children().each(function () {
                    if ($(this).text() == '0') {
                        $(this).text("个人")
                    } else if ($(this).text() == '1') {
                        $(this).text("单位")
                    }
                });
            }
        });



        // 模糊查询 搜索
        var $ = layui.$, active = {
            reload: function () {
                var demoReload = $('#demoReload').val();
                var domoin = $('#domoin').val();
                var departments = $('#departments').val();

                var itemsObjname = $('#itemsObjname').val();
                var itemsState = $('#itemsState').val();
                //执行重载
                table.reload('testReload', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    },
                    where: {
                        demoReload: demoReload,
                        domoin:domoin,
                        departments:departments,
                        itemsObjname:itemsObjname,
                        itemsState:itemsState
                    }
                });
            }
        };

        $('.demoTable .layui-btn').on('click', function (e) {
            e.preventDefault();
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

//批量删除
        $("#deleteUserByIds").click(function () {
            var checkStatus = table.checkStatus('testReload'),
                data = checkStatus.data,
                file_id = "";
            if (data.length > 0) {
                for (var i in data) {
                    file_id += data[i].item_id + ",";
                }
                console.log(file_id);
                layer.confirm('确定删除选中的数据？', {
                    icon: 3,
                    title: '提示信息'
                }, function (index) {
                    $.ajax({
                        url: '/delProByIds',
                        dataType: 'json',
                        type: 'post',
                        data: {
                            ids: file_id
                        },
                        success: function (data) {
                            if (data.code == 0) {
                                layer.msg("删除成功", {
                                    icon: 6
                                }, function () {
                                    location.reload()
                                    // window.location.href = "/selUser"
                                });
                            } else {
                                layer.alert("删除失败")
                            }
                        }

                    })
                })
            } else {
                layer.msg("请选择需要删除的用户");
            }
        });



        table.on('toolbar(test)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id);
            switch (obj.event) {
                case 'getCheckLength':
                    var data = checkStatus.data;
                    layer.msg('选中了：' + data.length + ' 个');
                    break;
                case 'edit':
                    layer.msg(obj.data.itemId)
                    break;
                // case 'allat':
                //     layer.msg(obj.data.circularId)
                //     break;
                // case 'addlevel':
                //     layer.msg(obj.data.rankName)
                //     break;
                case 'del':
                    layer.msg(obj.data.itemId)
                    break;
                case 'stop':
                    layer.msg(obj.data.itemId)
            }
            ;
        });
        //监听行工具事件
        table.on('tool(test)', function (obj) {
            var data = obj.data;
            console.log(data);

            if (obj.event === 'del') {
                var flag = confirm("您确定要删除吗？");
                if (flag) {
                    $.ajax({
                        type: "post",
                        dataType: "json",
                        url: 'delprojman',
                        data: {itemId: data.item_id},
                        success: function (data) {
                            if (data == "200") {
                                alert("删除成功");
                                window.location.href = "/promanjump";
                            } else {
                                alert("删除失败")
                            }
                        }
                    })
                }
                ;
            }


            if (obj.event === 'stop'){
                var flag = confirm("您确定要停用此项目？")
                if (flag){
                    $.ajax({
                        type: "post",
                        dataType: "json",
                        url: 'stopprojman',
                        data: {itemId: data.item_id},
                        success: function (data) {
                            if (data == "200") {
                                alert("停用成功");
                                window.location.href = "/promanjump";
                            } else {
                                alert("停用失败")
                            }
                        }
                    })
                }
            }



//修改项目回显
            if (obj.event === 'edit'){
                $("#boxDiv").css("display", "block");
                $("#updcircular_id").val(data.item_id)
                $("#updcircular_title").val(data.item_title);
                // $("#updre_sel").val(data.regionName);
                // $("#updde_sel").val(data.department_name);
                $("#updcircular_content").val(data.item_context);
                // $("#upddtd_sel").val(data.dtdName);
                // $("#upditem_obj").val(data.item_obj);upddo_sel
                // $("#upddo_sel").val(data.domoinName);
                $("#upditem_way").val(data.item_way);
                $("#upditem_gold").val(data.item_gold);
                $("#upditem_goMoney").val(data.item_goMoney);
                $("#upditem_condition").val(data.item_condition);
                $("#upditem_ask").val(data.item_ask);
                $("#upditem_askItem").val(data.item_askItem);
                $("#upditem_policy").val(data.item_policy);
                $("#upditem_goide").val(data.item_goide);
                $("#upditem_manage").val(data.item_manage);
                $("#upddtd_dtd").val(data.ctn_circularName);
                $("#upddtd_cps").val(data.cps_cpName);
                $("#do_sel").val(data.domoin_name);
                $("#de_sel").val(data.department_name);
                $("#ra_sel").val(data.rank_name);
                $("#circular_content").val(data.circular_content);
                $("#ci_sel").val(data.project_name);
                $("#updde_sel").val(data.department_name);
                $("#upddo_sel").val(data.domoin_name);
                $("#updre_sel").val(data.region_name);
                $("#upditem_obj").val(data.item_obj);
                $("#upddtd_sel").val(data.dtd_name);


            }
        });
    });

</script>
<script>
    //日期范围
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#test6'
            //设置开始日期、日期日期的 input 选择器
            //数组格式为 2.6.6 开始新增，之前版本直接配置 true 或任意分割字符即可
            , range: ['#userCreateTime', '#userFinishTime']
            // ,range: true
        });
    });


    //获取当前日期
    layui.use('laydate', function() {
        var laydate = layui.laydate;
        //常规用法
        laydate.render({
            type: 'date',
            value: new Date(new Date())
        });

    });
    var time=new Date();
    var date = time.getFullYear() + '-' + (time.getMonth() + 1) + '-' + time.getDate();
    console.log(date);

//添加项目
    function addsub() {
        var flag = confirm("您确定要添加该项目吗？")
        if (flag) {
            // let circular_id = document.getElementById("addcircular_id").value;
            let circularTitle = document.getElementById("addcircular_title").value;
            let regionName = document.getElementById("addre_sel").value;
            // let adddtd_sel = document.getElementById("adddtd_sel").value;
            let time = date
            let departmentName = document.getElementById("addde_sel").value;
            let itemContent = document.getElementById("additem_context").value;
            let dtdName = document.getElementById("adddtd_sel").value;
            let itemObj = document.getElementById("additem_obj").value;
            let domoinName = document.getElementById("adddo_sel").value;
            let itemWay = document.getElementById("additem_way").value;
            let itemGold = document.getElementById("additem_gold").value;
            let itemGoMoney = document.getElementById("additem_goMoney").value;
            let itemCondition = document.getElementById("additem_condition").value;
            let itemAsk = document.getElementById("additem_ask").value;
            let itemAskItem = document.getElementById("additem_askItem").value;
            let itemPolicy = document.getElementById("additem_policy").value;
            let itemGoide = document.getElementById("additem_goide").value;
            let itemManage = document.getElementById("additem_manage").value;
            //联系人地址
            // let addre_sel2 = document.getElementById("addre_sel2").value;
            // //联系人
            // let additem_gd
            let ctnCircularName = document.getElementById("adddtd_dtd").value;
            let cpsCpName = document.getElementById("adddtd_cps").value;
            $.ajax({
                url: "addprojman",
                async: true,
                type: "post",
                data: {
                    circularTitle: circularTitle,
                    regionName: regionName,
                    itemContent: itemContent,
                    time : time,
                    departmentName: departmentName,
                    // circularContent: circularContent,
                    dtdName:dtdName,
                    itemObj: itemObj,
                    domoinName: domoinName,
                    itemWay:itemWay,
                    itemGold:itemGold,
                    itemGoMoney:itemGoMoney,
                    itemCondition:itemCondition,
                    itemAsk:itemAsk,
                    itemAskItem:itemAskItem,
                    itemPolicy:itemPolicy,
                    itemGoide:itemGoide,
                    itemManage:itemManage,
                    ctnCircularName:ctnCircularName,
                    cpsCpName:cpsCpName
                },
                dataType: "json",
                success: function (data) {
                    if (data == "200") {
                        alert("添加成功")
                        window.location.href = "/promanjump";
                        // window.open("/success.jsp")
                    } else if (data == "201") {
                        alert("添加失败，请重新修改")
                    }else {
                        alert("已有此部门")
                    }
                }
            })
        }
    }

    function addle(){
        $("#boxDiv2").css("display", "block");
    }

    //修改
    function sub() {
        var flag = confirm("您确定要修改通知信息吗？")
        if (flag) {
            let itemId = document.getElementById("updcircular_id").value;
            let circularTitle = document.getElementById("updcircular_title").value;
            let regionName = document.getElementById("updre_sel").value;
            // let adddtd_sel = document.getElementById("adddtd_sel").value;
            let time = date;
            let departmentName = document.getElementById("updde_sel").value;
            let itemContent = document.getElementById("updcircular_content").value;
            let dtdName = document.getElementById("upddtd_sel").value;
            let itemObj = document.getElementById("upditem_obj").value;
            let domoinName = document.getElementById("upddo_sel").value;
            let itemWay = document.getElementById("upditem_way").value;
            let itemGold = document.getElementById("upditem_gold").value;
            let itemGoMoney = document.getElementById("upditem_goMoney").value;
            let itemCondition = document.getElementById("upditem_condition").value;
            let itemAsk = document.getElementById("upditem_ask").value;
            let itemAskItem = document.getElementById("upditem_askItem").value;
            let itemPolicy = document.getElementById("upditem_policy").value;
            let itemGoide = document.getElementById("upditem_goide").value;
            let itemManage = document.getElementById("upditem_manage").value;
            //联系人地址
            // let addre_sel2 = document.getElementById("addre_sel2").value;
            // //联系人
            // let additem_gd
            let ctnCircularName = document.getElementById("upddtd_dtd").value;
            let cpsCpName = document.getElementById("upddtd_cps").value;
            $.ajax({
                url: "updprojman",
                async: true,
                type: "post",
                data: {
                    itemId:itemId,
                    circularTitle: circularTitle,
                    regionName: regionName,
                    itemContent: itemContent,
                    time : time,
                    departmentName: departmentName,
                    // circularContent: circularContent,
                    dtdName:dtdName,
                    itemObj: itemObj,
                    domoinName: domoinName,
                    itemWay:itemWay,
                    itemGold:itemGold,
                    itemGoMoney:itemGoMoney,
                    itemCondition:itemCondition,
                    itemAsk:itemAsk,
                    itemAskItem:itemAskItem,
                    itemPolicy:itemPolicy,
                    itemGoide:itemGoide,
                    itemManage:itemManage,
                    ctnCircularName:ctnCircularName,
                    cpsCpName:cpsCpName
                },
                dataType: "json",
                success: function (data) {
                    if (data == "200") {
                        alert("修改成功")
                        window.location.href = "/promanjump";
                        // window.open("/success.jsp")
                    } else if (data == "201") {
                        alert("修改失败，请重新修改")
                    }else {
                        alert("已有此部门")
                    }
                }
            })
        }
    }

    //取消
    function cancel() {
        $("#boxDiv").css("display", "none");
        $("#boxDiv2").css("display", "none");
    }



</script>
<div style="width: 100%;background-color: whitesmoke; height: 100%; display: none;position: fixed;top:8%;"
     id="boxDiv">
    <form onsubmit="return false">
        <table border="0" bgcolor="whitesmoke" cellspacing="0" align="center" width="50%">
            <caption  style="font-size: 40px;">修改项目</caption>
                        <tr id="addid" style="display: none">
                            <th style="display: none">&nbsp;&nbsp;&nbsp;ID</th>
                            <td colspan="5"><input class="layui-layer-input" type="hidden" id="updcircular_id" style=""/></td>
                        </tr>
            <tr>
                <td  colspan="5">项目标题</td>
            </tr>
            <tr>
                <td colspan="5"><input class="layui-layer-input" type="text" id="updcircular_title" placeholder="请输入项目标题" autocomplete="off" style="width: 610px;height: 30px"/></td>
            </tr>
            <tr>
                <td colspan="5">地区</td>
                <td style="position: fixed; left: 53%">部门</td>
            </tr>
            <tr>


                <td>
                    <div class="layui-input-inline">
                        <select id="updre_sel" name="updre_sel" lay-verify="required"  class="updre_sel" style="width: 280px"></select>
                    </div>
                </td>
                <td style="position: fixed; left: 53%">
                    <div class="layui-input-inline">
                        <select id="updde_sel" name="updde_sel" lay-verify="required"  class="updde_sel" style="width: 262px"></select>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="5">项目描述</td>
            </tr>
            <tr>
                <td colspan="5"><textarea cols="85" id="updcircular_content" autocomplete="off"></textarea></td>
            </tr>
            <tr>
                <td colspan="5">申报方向</td>
            </tr>
            <tr>
                <td colspan="5">
                    <div class="layui-input-inline">
                        <select id="upddtd_sel" name="upddtd_sel" lay-verify="required"  class="upddtd_sel" style="width: 612px;height: 30px"></select>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="5">申报对象</td>
                <td  style="position: fixed; left: 53%">领域</td>
            </tr>
            <tr>
                <td>
                    <select id="upditem_obj" style="width: 280px;">
                        <option value="">--请选择--</option>
                        <option value="0">个人</option>
                        <option value="1">单位</option>
                    </select>
                </td>

                <td  style="position: fixed; left: 53%">
                    <div class="layui-input-inline">
                        <select id="upddo_sel" name="upddo_sel" lay-verify="required"  class="do_select" style="width: 262px"></select>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="5">支持方式</td>
            </tr>
            <tr>
                <td colspan="5"><input class="layui-layer-input" type="text" id="upditem_way" placeholder="请输入支持方式" autocomplete="off" style="width: 612px;height: 30px"/></td>
            </tr>
            <tr>
                <td colspan="5">扶持形式</td>
            </tr>
            <tr>
                <td colspan="5"><input class="layui-layer-input" type="text" id="upditem_gold" placeholder="请输入扶持形式" autocomplete="off" style="width: 612px;height: 30px"/></td>
            </tr>
            <tr>
                <td colspan="5">扶持金额</td>
            </tr>
            <tr>
                <td colspan="5"><input class="layui-layer-input" type="text" id="upditem_goMoney" placeholder="请输入扶持金额" autocomplete="off" style="width: 612px;height: 30px"/></td>
            </tr>

            <!--            <tr>-->
            <!--                <td>-->
            <!--                <div class="demoTable2">-->
            <!--                    注册时间:-->
            <!--                    <div class="layui-inline" id="time">-->
            <!--                        <div class="layui-input-inline">-->
            <!--                            <input type="text" autocomplete="off" name="id" id="additem_createTime" class="layui-input" placeholder="开始时间">-->
            <!--                        </div>-->
            <!--                        至-->
            <!--                        <div class="layui-input-inline">-->
            <!--                            <input type="text" autocomplete="off" name="id" id="additem_finishTime" class="layui-input" placeholder="结束时间">-->
            <!--                        </div>-->
            <!--                    </div>-->
            <!--                </div>-->
            <!--                </td>-->
            <!--            </tr>-->

            <tr>
                <td colspan="5">处理条件</td>
            </tr>
            <tr>
                <td colspan="5"><textarea cols="85" id="upditem_condition" autocomplete="off"></textarea></td>
            </tr>
            <tr>
                <td colspan="5">申报单位要求</td>
            </tr>
            <tr>
                <td colspan="5"><textarea cols="85" id="upditem_ask" autocomplete="off"></textarea></td>
            </tr>
            <tr>
                <td colspan="5">项目申报要求</td>
            </tr>
            <tr>
                <td colspan="5"><textarea cols="85" id="upditem_askItem" autocomplete="off"></textarea></td>
            </tr>
            <tr>
                <td colspan="5">政策依据</td>
            </tr>
            <tr>
                <td colspan="5"><textarea cols="85" id="upditem_policy" autocomplete="off"></textarea></td>
            </tr>
            <tr>
                <td colspan="5">
                    申报指南:
                </td>
            </tr>
            <tr>
                <td colspan="5"><input class="layui-layer-input" type="text" id="upditem_goide" placeholder="请输入申报指南" autocomplete="off" style="width: 612px;height: 30px"/></td>
            </tr>
            <tr>
                <td colspan="5">
                    管理办法:
                </td>
            </tr>
            <tr>
                <td colspan="5"><input class="layui-layer-input" type="text" id="upditem_manage" placeholder="请输入管理办法" autocomplete="off" style="width: 612px;height: 30px"/></td>
            </tr>

            <tr>
                <td colspan="5">咨询方式</td>
            </tr>
            <tr>
                <td>
<!--                    <div class="layui-input-inline">-->
                        <select id="updre_sel2" name="addre_sel2" lay-verify="required"  class="updre_sel2" style="width: 200px;position: fixed; left: 22%"></select>
                </td>
                <td>
                    <input class="layui-layer-input" type="text" id="upditem_gd" placeholder="请输入联系人" autocomplete="off" style="width: 180px;position: fixed; left: 41%"/>
                </td>
                <td>
                    <input class="layui-layer-input" type="text" id="upditem_gld" placeholder="请输入电话号" autocomplete="off" style="width: 200px;position: fixed; left: 58%"/>
<!--                    </div>-->
                </td>
            </tr>

            <!--            <tr>-->
            <!--                <th colspan="5"><a style="color: blue">+新建咨询方式</a></th>-->
            <!--            </tr>-->
            <!--            <tr>-->
            <!--                <td>办理流程</td>-->
            <!--                <td colspan="5"><input class="layui-layer-input" type="text" id="additem_way" placeholder="请输入支持方式" style="width: 93%"/></td>-->
            <!--            </tr>-->

            <tr>
                <td><hr></td>
            </tr>
            <tr>
                <td colspan="5">包含通知</td>
            </tr>
            <tr>
                <td colspan="5">
                    <div class="layui-input-inline">
                        <select id="upddtd_dtd" name="upddtd_dtd" lay-verify="required"  class="upddtd_dtd" style="width: 613px"></select>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="5">包含政策</td>
            </tr>
            <tr>
                <td colspan="5">
                    <div class="layui-input-inline">
                        <select id="upddtd_cps" name="upddtd_cps" lay-verify="required"  class="upddtd_cps" style="width: 613px"></select>
                    </div>
                </td>
            </tr>

            <!--            <tr>-->
            <!--                <th colspan="5"><a style="color: blue">+添加通知</a></th>-->
            <!--            </tr>-->
            <!--            <tr>-->
            <!--                <td>申报材料</td>-->
            <!--                <td colspan="5"><input class="layui-layer-input" type="text" id="additem_" placeholder="请输入所需材料" style="width: 93%"/></td>-->
            <!--            </tr>-->

            <tr>
                <td colspan="5">精准配</td>
            </tr>
            <tr>
                <td>
                    <div class="layui-input-inline">
                        <select id="updprecise_type" name="updprecise_type" lay-verify="required"  class="updprecise_type" style="width: 200px"></select>
                    </div>
                    <!--                </td>-->

                    <!--                <td>-->
                    <div class="layui-input-inline">
                        <select id="updprecise_option" name="updprecise_option" lay-verify="required"  class="updprecise_option" style="width: 410px"></select>
                    </div>
                </td>
            </tr>

            <!--            <tr>-->
            <!--                <th>附件</th>-->
            <!--                <td colspan="5"><input type="file"  style="width: 90%"/></td>-->
            <!--            </tr>-->
            <tr>
                <td rowspan="2"  colspan="5" align="center">
                    <button class="button1" onclick="sub()">提交</button>
                    <button class="button2" onclick="cancel()">取消</button>
                </td>
            </tr>
        </table>
    </form>
</div>

<div style="width: 100%;background-color: whitesmoke; height: 100%; display: none;position: fixed;top:8%;"
     id="boxDiv2">
    <form onsubmit="return false">
        <table border="0" bgcolor="whitesmoke" cellspacing="0" align="center" width="50%">
            <caption  style="font-size: 40px;">添加项目</caption>
            <tr id="adid" style="display: none">
                <th style="display: none">&nbsp;&nbsp;&nbsp;ID</th>
                <td colspan="5"><input class="layui-layer-input" type="hidden" id="addcircular_id" style=""/></td>
            </tr>
            <tr>
                <td  colspan="5">项目标题</td>
            </tr>
            <tr>
                <td colspan="5"><input class="layui-layer-input" type="text" id="addcircular_title" placeholder="请输入项目标题" autocomplete="off" style="width: 610px;height: 30px"/></td>
            </tr>
            <tr>
                <td colspan="5">地区</td>
                <td style="position: fixed; left: 53%">部门</td>
            </tr>
            <tr>


                <td>
                    <div class="layui-input-inline">
                        <select id="addre_sel" name="addre_sel" lay-verify="required"  class="addre_sel" style="width: 280px"></select>
                    </div>
                </td>
                <td style="position: fixed; left: 53%">
                    <div class="layui-input-inline">
                        <select id="addde_sel" name="addde_sel" lay-verify="required"  class="addde_sel" style="width: 262px"></select>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="5">项目描述</td>
            </tr>
            <tr>
                <td colspan="5"><textarea cols="85" id="additem_context" autocomplete="off"></textarea></td>
            </tr>
            <tr>
                <td colspan="5">申报方向</td>
            </tr>
            <tr>
                <td colspan="5">
                    <div class="layui-input-inline">
                        <select id="adddtd_sel" name="adddtd_sel" lay-verify="required"  class="adddtd_sel" style="width: 612px;height: 30px"></select>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="5">申报对象</td>
                <td  style="position: fixed; left: 53%">领域</td>
            </tr>
            <tr>
                <td>
                    <select id="additem_obj" style="width: 280px;">
                        <option value="">--请选择--</option>
                        <option value="0">个人</option>
                        <option value="1">单位</option>
                    </select>
                </td>

                <td  style="position: fixed; left: 53%">
                    <div class="layui-input-inline">
                        <select id="adddo_sel" name="adddo_sel" lay-verify="required"  class="adddo_sel" style="width: 262px"></select>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="5">支持方式</td>
            </tr>
            <tr>
                <td colspan="5"><input class="layui-layer-input" type="text" id="additem_way" placeholder="请输入支持方式" autocomplete="off" style="width: 612px;height: 30px"/></td>
            </tr>
            <tr>
                <td colspan="5">扶持形式</td>
            </tr>
            <tr>
                <td colspan="5"><input class="layui-layer-input" type="text" id="additem_gold" placeholder="请输入扶持形式" autocomplete="off" style="width: 612px;height: 30px"/></td>
            </tr>
            <tr>
                <td colspan="5">扶持金额</td>
            </tr>
            <tr>
                <td colspan="5"><input class="layui-layer-input" type="text" id="additem_goMoney" placeholder="请输入扶持金额" autocomplete="off" style="width: 612px;height: 30px"/></td>
            </tr>

            <tr>
                <td colspan="5">处理条件</td>
            </tr>
            <tr>
                <td colspan="5"><textarea cols="85" id="additem_condition" autocomplete="off"></textarea></td>
            </tr>
            <tr>
                <td colspan="5">申报单位要求</td>
            </tr>
            <tr>
                <td colspan="5"><textarea cols="85" id="additem_ask" autocomplete="off"></textarea></td>
            </tr>
            <tr>
                <td colspan="5">项目申报要求</td>
            </tr>
            <tr>
                <td colspan="5"><textarea cols="85" id="additem_askItem" autocomplete="off"></textarea></td>
            </tr>
            <tr>
                <td colspan="5">政策依据</td>
            </tr>
            <tr>
                <td colspan="5"><textarea cols="85" id="additem_policy" autocomplete="off"></textarea></td>
            </tr>
            <tr>
                <td colspan="5">
                    申报指南:
                </td>
            </tr>
            <tr>
                <td colspan="5"><input class="layui-layer-input" type="text" id="additem_goide" placeholder="请输入申报指南" autocomplete="off" style="width: 612px;height: 30px"/></td>
            </tr>
            <tr>
                <td colspan="5">
                    管理办法:
                </td>
            </tr>
            <tr>
                <td colspan="5"><input class="layui-layer-input" type="text" id="additem_manage" placeholder="请输入管理办法" autocomplete="off" style="width: 612px;height: 30px"/></td>
            </tr>

            <tr>
                <td colspan="5">咨询方式</td>
            </tr>
            <tr>
                <td>
                    <!--                    <div class="layui-input-inline">-->
                    <select id="addre_sel2" name="addre_sel2" lay-verify="required"  class="addre_sel2" style="width: 200px;position: fixed; left: 22%"></select>
                </td>
                <td>
                    <input class="layui-layer-input" type="text" id="additem_gd" placeholder="请输入联系人" autocomplete="off" style="width: 180px;position: fixed; left: 41%"/>
                </td>
                <td>
                    <input class="layui-layer-input" type="text" id="additem_gld" placeholder="请输入电话号" autocomplete="off" style="width: 200px;position: fixed; left: 58%"/>
                    <!--                    </div>-->
                </td>
            </tr>

            <tr>
                <td><hr></td>
            </tr>
            <tr>
                <td colspan="5">包含通知</td>
            </tr>
            <tr>
                <td colspan="5">
                    <div class="layui-input-inline">
                        <select id="adddtd_dtd" name="adddtd_dtd" lay-verify="required"  class="adddtd_dtd" style="width: 613px"></select>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="5">包含政策</td>
            </tr>
            <tr>
                <td colspan="5">
                    <div class="layui-input-inline">
                        <select id="adddtd_cps" name="adddtd_cps" lay-verify="required"  class="adddtd_cps" style="width: 613px"></select>
                    </div>
                </td>
            </tr>

            <!--            <tr>-->
            <!--                <th colspan="5"><a style="color: blue">+添加通知</a></th>-->
            <!--            </tr>-->
            <!--            <tr>-->
            <!--                <td>申报材料</td>-->
            <!--                <td colspan="5"><input class="layui-layer-input" type="text" id="additem_" placeholder="请输入所需材料" style="width: 93%"/></td>-->
            <!--            </tr>-->

            <tr>
                <td colspan="5">精准配</td>
            </tr>
            <tr>
                <td>
                    <div class="layui-input-inline">
                        <select id="addprecise_type" name="addprecise_type" lay-verify="required"  class="addprecise_type" style="width: 200px"></select>
                    </div>
                    <!--                </td>-->

                    <!--                <td>-->
                    <div class="layui-input-inline">
                        <select id="addprecise_option" name="addprecise_option" lay-verify="required"  class="addprecise_option" style="width: 410px"></select>
                    </div>
                </td>
            </tr>

            <!--            <tr>-->
            <!--                <th>附件</th>-->
            <!--                <td colspan="5"><input type="file"  style="width: 90%"/></td>-->
            <!--            </tr>-->
            <tr>
                <td rowspan="2"  colspan="5" align="center">
                    <button class="button1" onclick="addsub()">提交</button>
                    <button class="button2" onclick="cancel()">取消</button>
                </td>
            </tr>
        </table>
    </form>
</div>


<script>

    layui.use('form',function(){
        var $ = layui.jquery
        var form = layui.form
//地区
        $.ajax({
            url: '/selRe',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#addre_sel").empty();
                    $("#addre_sel").append(new Option("请选择地区", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.regionName
                        $('#addre_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#addre_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("addre_select");
            }
        });
//领域
        $.ajax({
            url: '/selDo',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#adddo_sel").empty();
                    $("#adddo_sel").append(new Option("请选择领域", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.domoinName
                        $('#adddo_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#adddo_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("adddo_select");
            }
        });
//部门
        $.ajax({
            url: '/selDe',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#addde_sel").empty();
                    $("#addde_sel").append(new Option("请选择部门", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.departmentName
                        $('#addde_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#addde_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("addde_select");
            }
        });
//级别
        $.ajax({
            url: '/selRa',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#addra_sel").empty();
                    $("#addra_sel").append(new Option("请选择级别", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.rankName
                        $('#addra_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#addra_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("addra_select");
            }
        });

// 项目
//         $.ajax({
//             url: '/selDtd',
//             dataType: 'json',
//             type: 'post',
//             success: function(data) {
//                 if (data!== null) {
//                     $("#addci_sel").empty();
//                     $("#addci_sel").append(new Option("请选择项目", "0"));
//                     $.each(data, function(index, item) {
//                         var domo = item.projectName
//                         $('#addci_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
//                     });
//                 } else {
//                     $("#addci_sel").append(new Option("暂无数据", ""));
//                 }
//                 //重新渲染
//                 form.render("addci_select");
//             }
//         });
        // });

//申报方向
        $.ajax({
            url: '/selDtd',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#adddtd_sel").empty();
                    $("#adddtd_sel").append(new Option("请选择申报方向", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.dtd_name
                        $('#adddtd_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#adddtd_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("adddtd_sel");
            }
        });

//咨询方式地区
        $.ajax({
            url: '/selRe',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#addre_sel2").empty();
                    $("#addre_sel2").append(new Option("请选择地区", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.regionName
                        $('#addre_sel2').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#addre_sel2").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("addre_select2");
            }
        });

//包含通知
        $.ajax({
            url: '/selDte',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#adddtd_dtd").empty();
                    $("#adddtd_dtd").append(new Option("请选择包含通知", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.ctn_circularName
                        $('#adddtd_dtd').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#adddtd_dtd").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("adddtd_dtd");
            }
        });

//包含政策
        $.ajax({
            url: '/selCps',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#adddtd_cps").empty();
                    $("#adddtd_cps").append(new Option("请选择包含政策", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.cps_cpName
                        $('#adddtd_cps').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#adddtd_cps").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("adddtd_cps");
            }
        });

//精准配类别
        $.ajax({
            url: '/selType',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#addprecise_type").empty();
                    $("#addprecise_type").append(new Option("类别", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.precise_type
                        $('#addprecise_type').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#addprecise_type").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("addprecise_type");
            }
        });

//精准配选项
        $.ajax({
            url: '/selType',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#addprecise_option").empty();
                    $("#addprecise_option").append(new Option("选项", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.precise_option
                        $('#addprecise_option').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#addprecise_option").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("addprecise_option");
            }
        });







//修改地区
        $.ajax({
            url: '/selRe',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#updre_sel").empty();
                    $("#updre_sel").append(new Option("请选择地区", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.regionName
                        $('#updre_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#updre_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("updre_sel");
            }
        });
//修改领域
        $.ajax({
            url: '/selDo',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#upddo_sel").empty();
                    $("#upddo_sel").append(new Option("请选择领域", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.domoinName
                        $('#upddo_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#upddo_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("upddo_sel");
            }
        });
//修改部门
        $.ajax({
            url: '/selDe',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#updde_sel").empty();
                    $("#updde_sel").append(new Option("请选择部门", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.departmentName
                        $('#updde_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#updde_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("updde_sel");
            }
        });
//修改级别
        $.ajax({
            url: '/selRa',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#updra_sel").empty();
                    $("#updra_sel").append(new Option("请选择级别", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.rankName
                        $('#updra_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#updra_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("updra_sel");
            }
        });

// 修改项目
//         $.ajax({
//             url: '/selCi',
//             dataType: 'json',
//             type: 'post',
//             success: function(data) {
//                 if (data!== null) {
//                     $("#updci_sel").empty();
//                     $("#updci_sel").append(new Option("请选择项目", "0"));
//                     $.each(data, function(index, item) {
//                         var domo = item.projectName
//                         $('#updci_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
//                     });
//                 } else {
//                     $("#updci_sel").append(new Option("暂无数据", ""));
//                 }
//                 //重新渲染
//                 form.render("updci_sel");
//             }
//         });



//申报方向
         $.ajax({
            url: '/selDtd',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#upddtd_sel").empty();
                    $("#upddtd_sel").append(new Option("请选择申报方向", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.dtd_name
                        $('#upddtd_sel').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#upddtd_sel").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("upddtd_sel");
            }
        });

//咨询方式地区
        $.ajax({
            url: '/selRe',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#updre_sel2").empty();
                    $("#updre_sel2").append(new Option("请选择地区", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.regionName
                        $('#updre_sel2').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#updre_sel2").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("updre_sel2");
            }
        });

//包含通知
        $.ajax({
            url: '/selDte',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#upddtd_dtd").empty();
                    $("#upddtd_dtd").append(new Option("请选择包含通知", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.ctn_circularName
                        $('#upddtd_dtd').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#upddtd_dtd").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("upddtd_dtd");
            }
        });

//包含政策
        $.ajax({
            url: '/selCps',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#upddtd_cps").empty();
                    $("#upddtd_cps").append(new Option("请选择包含政策", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.cps_cpName
                        $('#upddtd_cps').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#upddtd_cps").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("upddtd_cps");
            }
        });

//精准配类别
        $.ajax({
            url: '/selType',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#updprecise_type").empty();
                    $("#updprecise_type").append(new Option("类别", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.precise_type
                        $('#updprecise_type').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#updprecise_type").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("updprecise_type");
            }
        });

//精准配选项
        $.ajax({
            url: '/selType',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#updprecise_option").empty();
                    $("#updprecise_option").append(new Option("选项", "0"));
                    $.each(data, function(index, item) {
                        var domo = item.precise_option
                        $('#updprecise_option').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#updprecise_option").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("updprecise_option");
            }
        });


        //搜索部门
        layui.use('form', function () {
            var $ = layui.jquery;
            var form = layui.form;
            //地区
            $.ajax({
                url: '/selDe',
                dataType: 'json',
                type: 'post',
                success: function(data) {
                    if (data!== null) {
                        $("#departments").empty();
                        $("#departments").append(new Option("请选择部门", ""));
                        $.each(data, function(index, item) {
                            var domo = item.departmentName
                            $('#departments').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                        });
                    } else {
                        $("#departments").append(new Option("暂无数据", ""));
                    }
                    //重新渲染
                    form.render("#departments");
                }
            });

    //搜索领域
            $.ajax({
                url: '/selDo',
                dataType: 'json',
                type: 'post',
                success: function(data) {
                    if (data!== null) {
                        $("#domoin").empty();
                        $("#domoin").append(new Option("请选择领域", ""));
                        $.each(data, function(index, item) {
                            var domo = item.domoinName
                            $('#domoin').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                        });
                    } else {
                        $("#domoin").append(new Option("暂无数据", ""));
                    }
                    //重新渲染
                    form.render("domoin");
                }
            });
        })

        //搜索级别
        $.ajax({
            url: '/selRa',
            dataType: 'json',
            type: 'post',
            success: function(data) {
                if (data!== null) {
                    $("#rank").empty();
                    $("#rank").append(new Option("请选择级别", ""));
                    $.each(data, function(index, item) {
                        var domo = item.rankName
                        $('#rank').append(new Option(JSON.stringify(domo).replace(/\"/g, "")));
                    });
                } else {
                    $("#rank").append(new Option("暂无数据", ""));
                }
                //重新渲染
                form.render("rank");
            }
        });
    });
</script>
</body>
</html>
